﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using MuchoMusculo.BusinessObjects;
using System.Transactions;

namespace MuchoMusculo.Business
{
    public partial class bsControles
    {
        public List<tbControles> GetListControls()
        {
            BDMuchoMusculosDataContext dc = new BDMuchoMusculosDataContext();
            List<tbControles> controls = new List<tbControles>();

            controls = (from c in dc.tbControles

                        select c).ToList();
            return controls;
        }

        public void  AddControl(tbControles newControl)
        {
            BDMuchoMusculosDataContext dc = new BDMuchoMusculosDataContext();
            
            dc.tbControles.InsertOnSubmit(newControl);
            dc.SubmitChanges();
        }

        public void EditControl(tbControles editControl)
        {
            BDMuchoMusculosDataContext dc = new BDMuchoMusculosDataContext();
            tbControles control = dc.tbControles.Single(x => x.idControl == editControl.idControl);

            control.idControl = editControl.idControl;
            control.indiceGrasaCorporal = editControl.indiceGrasaCorporal;
            control.indiceMasaCorporal = editControl.indiceMasaCorporal;
            control.leciones = editControl.leciones;
            control.modificadoPor = editControl.modificadoPor;
            control.pesoActual = editControl.pesoActual;
            control.tallaAbdomen = editControl.tallaAbdomen;
            //Falta...

        }
    }
}
